<?php

class Test_Abovo_Model_Invites extends Solar_Test {
    
    private $_invites;
    
    public function __construct()
    {
        parent::__construct();
        $this->_invites = Solar::factory('Abovo_Model_Invites');
    }
    
    public function testCreate()
    {
        $this->skip();
        $invite = $this->_invites->create('antti@phphalo.com', 'antti');
    }
    
    public function testIsValid()
    {
        $invite = $this->_invites->create('antti@phphalo.com', 'antti');
        
        $this->assertTrue($this->_invites->isValid($invite['hash']));
        $this->assertFalse($this->_invites->isValid('1111111'));
    }
    
    public function testApprove()
    {
        $invite = $this->_invites->create('antti@phphalo.com', 'antti');
        
        $this->_invites->approve($invite['hash']);
        
        $invite = $this->_invites->fetchRow(array('hash = ?' => $invite['hash']));
        
        $this->assertTrue($invite->status == Abovo_Model_Invites::STATUS_APPROVED);
    }
}
